All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class sun.server.util.SimpleHashtable

java.lang.Object
   |
   +----java.util.Dictionary
           |
           +----sun.server.util.SimpleHashtable

public class SimpleHashtable
extends Dictionary
implements Cloneable
This class implements a hashtable based on java.util.Hashtable. This hashtable is not extensible; the size is set as part of the constructor. However, it does allow for unsynchronized get operations. It does not support serialization. It uses String.hashCode() (when the object is a String), which is known to have problems for long strings.

See Also:
Hashtable, equals, hashCode

Constructor Index

 o SimpleHashtable()
Constructs a new, empty hashtable with a default capacity.
 o SimpleHashtable(int)
Constructs a new, empty hashtable with the specified initial capacity.

Method Index

 o clear()
Clears this hashtable so that it contains no keys.
 o contains(Object)
Tests if some key maps into the specified value in this hashtable.
 o containsKey(Object)
Tests if the specified object is a key in this hashtable.
 o elements()
Returns an enumeration of the values in this hashtable.
 o get(Object)
Returns the value to which the specified key is mapped in this hashtable.
 o isEmpty()
Tests if this hashtable maps no keys to values.
 o keys()
Returns an enumeration of the keys in this hashtable.
 o put(Object, Object)
Maps the specified key to the specified value in this hashtable.
 o remove(Object)
Removes the key (and its corresponding value) from this hashtable.
 o size()
Returns the number of keys in this hashtable.
 o toString()
Returns a rather long string representation of this hashtable.

Constructors

 o SimpleHashtable
 public SimpleHashtable(int initialCapacity)
Constructs a new, empty hashtable with the specified initial capacity.

Parameters:
initialCapacity - the initial capacity of the hashtable.
Throws: IllegalArgumentException
if the initial capacity is less than or equal to zero.
 o SimpleHashtable
 public SimpleHashtable()
Constructs a new, empty hashtable with a default capacity.

Methods

 o size
 public int size()
Returns the number of keys in this hashtable.

Returns:
the number of keys in this hashtable.
Overrides:
size in class Dictionary
 o isEmpty
 public boolean isEmpty()
Tests if this hashtable maps no keys to values.

Returns:
true if this hashtable maps no keys to values; false otherwise.
Overrides:
isEmpty in class Dictionary
 o keys
 public synchronized Enumeration keys()
Returns an enumeration of the keys in this hashtable.

Returns:
an enumeration of the keys in this hashtable.
Overrides:
keys in class Dictionary
See Also:
Enumeration
 o elements
 public synchronized Enumeration elements()
Returns an enumeration of the values in this hashtable. Use the Enumeration methods on the returned object to fetch the elements sequentially.

Returns:
an enumeration of the values in this hashtable.
Overrides:
elements in class Dictionary
See Also:
Enumeration, keys
 o contains
 public boolean contains(Object value)
Tests if some key maps into the specified value in this hashtable. This operation is more expensive than the containsKey method.

Parameters:
value - a value to search for.
Returns:
true if some key maps to the value argument in this hashtable; false otherwise.
Throws: NullPointerException
if the value is null.
 o containsKey
 public boolean containsKey(Object key)
Tests if the specified object is a key in this hashtable.

Parameters:
key - possible key.
Returns:
true if the specified object is a key in this hashtable; false otherwise.
 o get
 public Object get(Object key)
Returns the value to which the specified key is mapped in this hashtable.

Parameters:
key - a key in the hashtable.
Returns:
the value to which the key is mapped in this hashtable; null if the key is not mapped to any value in this hashtable.
Overrides:
get in class Dictionary
 o put
 public synchronized Object put(Object key,
                                Object value)
Maps the specified key to the specified value in this hashtable. Neither the key nor the value can be null.

The value can be retrieved by calling the get method with a key that is equal to the original key.

Parameters:
key - the hashtable key.
value - the value.
Returns:
the previous value of the specified key in this hashtable, or null if it did not have one.
Throws: NullPointerException
if the key or value is null.
Overrides:
put in class Dictionary
 o remove
 public synchronized Object remove(Object key)
Removes the key (and its corresponding value) from this hashtable. This method does nothing if the key is not in the hashtable.

Parameters:
key - the key that needs to be removed.
Returns:
the value to which the key had been mapped in this hashtable, or null if the key did not have a mapping.
Overrides:
remove in class Dictionary
 o clear
 public synchronized void clear()
Clears this hashtable so that it contains no keys.

 o toString
 public synchronized String toString()
Returns a rather long string representation of this hashtable.

Returns:
a string representation of this hashtable.
Overrides:
toString in class Object

All Packages  Class Hierarchy  This Package  Previous  Next  Index